﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>广告交易记录-微街秀管理后台</title>
    <link href="../../Client/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="../css/admin.css" rel="stylesheet" type="text/css" />
    <script src="../js/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script src="../js/base.js" type="text/javascript"></script>
    <script src="../js/ajax-data.js" type="text/javascript"></script>
    <script src="../js/Pager.js" type="text/javascript"></script>
    <script src="../js/dialog.js" type="text/javascript"></script>
<style>
body{ background-color:White; font-size:13px;}
table{border-collapse: collapse;border: none;width:100%; text-align:center;}
td{border: solid #ccc 1px;color:Black; height:26px;}
td a{ text-decoration:none;}
.td1,.td2,.td3,.td6{width:100px; font-weight:bold; text-align:center;}
.td4,.td5{width:160px; font-weight:bold; text-align:center;}
.td4{width:50px;}
/*分页*/
.pager_style{width:100%;height:30px;margin-top:10px;text-align:left;color:#909090;}
.pager_style li{font-size:14px;}
.pager_style .page_num{height:100%;font-size:0;display:inline-block; float:left;}
.pager_style .page_num li{height:100%;border:1px solid #eeeeee;padding:0 10px;margin-right:5px;line-height:30px;display:inline-block;cursor:pointer;float:left;}
.pager_style .page_num li:hover{border:1px solid #f37b0b;background-color:#f37b0b;color:White;}

/*分页 选中当页样式*/
.pager_style .page_num .active{border:1px solid #f37b0b;background-color:#f37b0b;color:White;cursor:default;}
/*分页 不可用样式*/
.pager_style .page_num .disable{background-color:#f1f1f1;}
.pager_style .page_num .disable:hover{border:1px solid #eeeeee;background-color:#f1f1f1;color:#909090;}

.pager_style .page_info{display:none;float:left;}
.pager_style .page_info li{display:inline-block;margin-left:10px;float:left;line-height: 30px;}
#direction1,#direction2{ padding-left:10px;}
</style>
</head>
<body class="mainbody">
<div class="navigation"><a href="javascript:" class="back" onclick="back()">后退</a>首页 &gt; 交易管理 &gt; <span class="headtitle">广告交易记录</span></div>
<hr style="margin-top:0px;">
<div style="width:880px; margin-left:auto; margin-right:auto;">
<div style="height:30px">微街秀ID:<input type="text" id="userid" name="userid" style="width:80px;" />
     类型:<select id="direction">
                <option value="-1">不限</option>
                <option value="1">收入</option>
                <option value="2">支出</option>
            </select>

    <input type="button" id="btn" value="搜 索" onclick="submits()" /></div>
     <div>用户余额：<span id="balance">0</span>元 &nbsp;&nbsp;&nbsp;总支出：<span id="direction1">0</span>元 &nbsp;&nbsp;&nbsp; 总收入：<span id="direction2">0</span>元</div>
 <div>本次提现：<span id="amount">0</span>元</div>
 <div>状态：<span id="state"></span></div>
    <br />
  <table>
  <tr>
      <td style="width:60px;">微街秀ID</td>
      <td style="width:60px;">交易金额</td>
      <td style="width:60px;">余额</td>
      <td style="width:60px;">类型</td>
      <td style="width:60px;">IP</td>
      <td >交易时间</td>
      <td style="width:220px;">广告</td>
      <td style="width:180px;">备注</td>
  </tr>
  <tbody id="list"></tbody>
    </table>
 <div class="pager_style">
    <ul class="page_num"></ul>
    <ul class="page_info">
        <li>总数:<span id="count">0</span></li>
        <li>每页:<span id="pageSize">0</span></li>
        <li>页数:<span id="pageToal">0</span></li>
    </ul>
</div>
<input type="hidden" id="pagecount" value="0" />
</div>
 <script>
     $(function () {
         $(".l-selected a", window.parent.document).html($(".headtitle").html())    //tab的标题         
         GetList(1);
     })

     function GetList(page) {
         if (getQueryString("userid") != null)
             $("#userid").val(getQueryString("userid"));

         var param = "page_index=" + page;
         param += "&userid=" + $("#userid").val();
         param += "&state=" + $("#state").val();
         param += "&direction=" + $("#direction").val();
         param += "&orderid=" + $("#orderid").val();

         $("#list").html("");
         var html = "";

         AjaxStart("../ajax/fc_record.ashx?getlist", param, function (data) {
             if (data.code != 0) {
                 $("#list").html(html + "<tr><td colspan='8'>" + data.msg + "</td></tr>");
             }
             else {
                 $("#list").html("");
                 var list = data.item.table;
                 for (var i = 0; i < list.length; i++) {
                     var direction = "";
                     if (list[i].direction == 1)
                         direction = "收入";
                     else if (list[i].direction == 2)
                         direction = "支出";
                     var state = '';
                     if (list[i].state == 1)
                         state = "<span style='color: green;'>成功</span>";
                     else if (list[i].state == 0) {
                         if (list[i].callback_date == null)
                             state = "<span style='color:#ccc;'>取消</span>";
                         else
                             state = "<span style='color:red'>失败</span>";
                     }
                     html += "<tr>";
                     html += "<td>" + list[i].user_id + "</td>";
                     html += "<td>" + (list[i].direction == 1 ? "+" + list[i].amount : list[i].amount) + "元</td>";
                     html += "<td>" + list[i].balance + "元</td>";
                     html += "<td>" + direction + "</td>";
                     html += "<td>" + list[i].ip + "</td>";
                     html += "<td>" + DateFormat(list[i].date) + "</td>";
                     html += "<td>" + "<a href='../../client/fc_detail.aspx?article_id=" + list[i].articleid + "' target=\"_blank\">" + (list[i].title == null ? "" : list[i].title) + "</a></td>";
                     var remark = "";
                     if (list[i].direction == 1)
                         remark =  (list[i].remark == null ? "" : list[i].remark) ;
                     else
                         remark = '提现';
                     html += "<td style='text-align:left;'>" + remark + "</td>";
                     html += "</tr>";
                 }

                 $("#list").html(html);
                 var pager = new Pager();
                 $(".page_info").css("display", "block")
                 pager.initPage(page, data.item.itemCount, 20, 5, GetList);
             }
         });
     }

     function DateFormat(date) {
         return date.toString().replace("T", " ").substring(0, 19)
     }
     function submits() {
         GetList(1);
     }
 </script>
</body>
</html>
